package com.slz3.business.module.goodsManagement.gooOutWarehouse.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.goodsManagement.gooOutWarehouse.domain.GooOutWarehouse;
import com.slz3.business.module.goodsManagement.gooOutWarehouse.domain.GooOutWarehouseFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class GooOutWarehouseTransactionalServiceImpl implements GooOutWarehouseTransactionalService {

    @Override
    public GooOutWarehouse modify(GooOutWarehouse gooOutWarehouseNew) {
        Repositorys.gooOutWarehouse.test();
        Repositorys.gooOutWarehouse.save(GooOutWarehouseFactory.initBaseFields());
        System.err.println(1 / 0);
        gooOutWarehouseNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.gooOutWarehouse.saveAndFlush(gooOutWarehouseNew);
    }

    @Override
    public List<GooOutWarehouse> batchModify(List<GooOutWarehouse> gooOutWarehouseList) {
        return Repositorys.gooOutWarehouse.saveAll(gooOutWarehouseList);
    }
}
